package com.djq.project.mq.producer.queues;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class SendQueues {

    @Autowired
    private RabbitTemplate template;

    @RequestMapping("/sendQueues")
    @Scheduled(fixedDelay = 1000, initialDelay = 500)
    public void sendQueues(String message) {
        // queues名称 消息
        this.template.convertAndSend("work", message);
        System.out.println(" [work] Sent '" + message + "'");
    }
}
